learn relation and function